package com.tianyadu.mmall.entity;

import com.fasterxml.jackson.annotation.JsonView;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Past;
import java.util.Date;

/**
 * 测试用户实例
 *
 * @author xueyj
 * @date 2019-09-20 22:10
 */
public class Person {
    /**
     * id
     */
    private String id;

    ;
    /**
     * 自定义api名称
     */
   /* @MyConstraint(message = "这是一个测试")
    @ApiModelProperty(value = "用户名")*/
    private String username;

    ;
    /**
     * 密码不能为空
     */
    @NotBlank(message = "密码不能为空")
    private String password;
    /**
     * 生日必须是过去时间
     */
    @Past(message = "生日必须是过去的时间")
    private Date birthday;

    /**
     * 简易view定义
     */
    @JsonView(PersonSimpleView.class)
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    /**
     * 详细view定义
     */
    @JsonView(PersonDetailView.class)
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    /**
     * 简易view定义
     */
    @JsonView(PersonSimpleView.class)
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    /**
     * 简易view定义
     */
    @JsonView(PersonSimpleView.class)
    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    /**
     * 声明简易view
     */
    public interface PersonSimpleView {
    }

    /**
     * 声明详细view
     */
    public interface PersonDetailView extends PersonSimpleView {
    }
}